<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <a class="list-group-item" v-link="{ path: '/home' }">Home</a>
    <a class="list-group-item" v-link="{ path: '/about' }">About</a>
    <router-view></router-view>
  </div>
  <template id="home">
    <div>
      <h1>Home</h1>
      <p>{{msg}}</p>
    </div>
    <div>
      <ul class="nav nav-tabs">
        <li><a v-link="{ path: '/home/news'}">News</a></li>
        <li><a v-link="{ path: '/home/message'}">Messages</a></li>
      </ul>
      <router-view></router-view>
    </div>
  </template>
  <template id="news">
    <ul>
      <li>News 01</li>
      <li>News 02</li>
      <li>News 03</li>
    </ul>
  </template>
  <template id="message">
    <ul>
      <li>Message 01</li>
      <li>Message 02</li>
      <li>Message 03</li>
    </ul>
  </template>
  <script src="js/vue.js" charset="utf-8"></script>
  <script src="js/vue-router.min.js" charset="utf-8"></script>
  <script type="text/javascript">
    var Home = Vue.extend({
      template: '#home',
      data: function () {
        return {
          msg: 'Hello, vur router!'
        }
      }
    })

    var News = Vue.extend({
      template: '#news'
    })

    var Message = Vue.extend({
      template: '#message'
    })

    var About = Vue.extend({
      template: '<div><h1>About</h1><p>This is the tutorial about vue-router.</p></div>'
    })

    var router = new VueRouter();
    router.map({
      '/home': {
        component: Home,
        subRoutes: {
          '/news': {
            component: News
          },
          '/message': {
            component: Message
          }
        }
      },
      '/about': {
        component: About
      }
    })

    var App = Vue.extend({});
    router.start(App, '#app');
  </script>
</body>
</html>
